package com.zzw.hj2;

import java.util.Scanner;

/**
 * @Project: hw_java
 * @Description: 计算某字符出现次数
 * @Author: zzw
 */

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String inputStr = in.nextLine();
        String inputChar = in.next();
        int charNum = 0;

        char[] chars = inputStr.toLowerCase().toCharArray();
        char inputChar2 = inputChar.toLowerCase().charAt(0);
        for (char c : chars) {
            if (c == inputChar2) {
                charNum++;
            }
        }

        System.out.print(charNum);
    }
}
